function AppAssistant() {
}

/** The handleLaunch function of the AppAssistant is called when the application is first launched.
 * Based on launchParams.source, the application can determine whether to launch the card view
 * and login page, or whether to go directly to a specific view if the application was launched
 * via a specific alarm call instead of through the launcher panel.
 * @param {JSON Object} launchParams
 */
AppAssistant.prototype.handleLaunch = function(launchParams) {
	/** If the application is launched from anything but the "sat_alarm_call" (such as through the
	 * application's icon in the launcher, handleLaunch will create the main stage, and then push the
	 * login card onto the stage stack.
	 */
	if (launchParams.source != "sat_alarm_call") {
		var mainStageArgs = {name: 'mainStage', lightweight: false};
		var stageProxy = this.controller.getStageProxy('mainStage');
		var stageController = this.controller.getStageController('mainStage');
		if (stageProxy) {
			if (stageController) {
				stageController.window.focus();
			}
		} else {
			var pushLogin = function(stageController) {
				stageController.pushScene('login');
			};
			this.controller.createStageWithCallback(mainStageArgs, pushLogin, "card");
		}
	/** If the application is launched from the "sat_alarm_call", meaning the a satellite is currently
	 * passing overhead, the main stage is created, but the satellite scene is pushed immediately,
	 * instead of starting off at the login screen.
	 */
	} else if (launchParams.source == "sat_alarm_call") {
		var mainStageArgs = {name: 'mainStage', lightweight: false};
		var stageProxy = this.controller.getStageProxy('mainStage');
		var stageController = this.controller.getStageController('mainStage');
		if (stageProxy) {
			if (stageController) {
				stageController.window.focus();
				Mojo.Controller.getAppController().showBanner("Satellite alarm called.",
   					{source: 'sat_alarm_banner'});
			}
		} else {
			var pushSatellite = function(stageController) {
				stageController.pushScene('satellite');
			};
			this.controller.createStageWithCallback(mainStageArgs, pushSatellite, "card");
		}
	}
}